![]() |
Kinetis SDK API Reference Manual
1.0.0-beta
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the SIM HAL driver. More...
Data Structures | |
| struct | sim_clock_gate_module_config_t |
| Clock gate module configuration table structure. More... | |
| struct | sim_clock_source_value_t |
| clock source value table structure More... | |
| struct | sim_clock_name_config_t |
| Clock name configuration table structure. More... | |
Enumerations | |
| enum | sim_clock_names_t { kSimCoreClock, kSimSystemClock, kSimPlatformClock, kSimBusClock, kSimFlexBusClock, kSimFlashClock, kSimOsc32kClock, kSimOsc0ErClock, kSimOsc1ErClock, kSimIrc48mClock, kSimRtc32kClock, kSimRtc1hzClock, kSimLpoClock, kSimMcgFllClock, kSimMcgPll0Clock, kSimMcgPll1Clock, kSimMcgOutClock, kSimMcgIrClock, kSimSDHC0_CLKIN, kSimENET_1588_CLKIN, kSimEXTAL_Clock, kSimEXTAL1_Clock, kSimUSB_CLKIN, kSimReserved, kSimClockNameCount } |
| enum | sim_clock_gate_module_names_t { kSimClockModuleDMA, kSimClockModuleDMAMUX, kSimClockModulePORT, kSimClockModuleMPU, kSimClockModuleLLWU, kSimClockModuleEWM, kSimClockModuleOSC1, kSimClockModuleFTF, kSimClockModuleNFC, kSimClockModuleFLEXBUS, kSimClockModuleDDR, kSimClockModuleCRC, kSimClockModuleRNGA, kSimClockModuleREGFILE, kSimClockModuleDRYICESECREG, kSimClockModuleDRYICE, kSimClockModuleADC, kSimClockModuleCMP, kSimClockModuleDAC, kSimClockModuleVREF, kSimClockModuleSAI, kSimClockModuleTPM, kSimClockModulePDB, kSimClockModuleFTM, kSimClockModulePIT, kSimClockModuleLPTIMER, kSimClockModuleCMT, kSimClockModuleRTC, kSimClockModuleENET, kSimClockModuleUSBHS, kSimClockModuleUSBFS, kSimClockModuleUSBDCD, kSimClockModuleFLEXCAN, kSimClockModuleSPI, kSimClockModuleI2C, kSimClockModuleUART, kSimClockModuleESDHC, kSimClockModuleLPUART, kSimClockModuleTSI, kSimClockModuleLCDC, kSimClockModuleMax } |
| Clock gate module names. | |
| enum | sim_clock_source_names_t { kSimClockNfcSrc, kSimClockEsdhcSrc, kSimClockSdhcSrc, kSimClockLcdcSrc, kSimClockTimeSrc, kSimClockRmiiSrc, kSimClockUsbfSrc, kSimClockUsbSrc, kSimClockUsbhSrc, kSimClockUart0Src, kSimClockTpmSrc, kSimClockOsc32kSel, kSimClockUsbfSel, kSimClockPllfllSel, kSimClockNfcSel, kSimClockLcdcSel, kSimClockTraceSel, kSimClockClkoutSel, kSimClockRtcClkoutSel, kSimClockSourceMax } |
| Clock source and sel names. | |
| enum | sim_clock_divider_names_t { kSimClockDividerOutdiv1, kSimClockDividerOutdiv2, kSimClockDividerOutdiv3, kSimClockDividerOutdiv4, kSimClockDividerUsbFrac, kSimClockDividerUsbDiv, kSimClockDividerUsbfsFrac, kSimClockDividerUsbfsDiv, kSimClockDividerUsbhsFrac, kSimClockDividerUsbhsDiv, kSimClockDividerLcdcFrac, kSimClockDividerLcdcDiv, kSimClockDividerNfcFrac, kSimClockDividerNfcDiv, kSimClockDividerSpecial1, kSimClockDividerMax } |
| Clock Divider names. | |
| enum | sim_usbsstby_stop_t { kSimUsbsstbyNoRegulator, kSimUsbsstbyWithRegulator } |
| SIM USB voltage regulator in standby mode setting during stop modes. | |
| enum | sim_usbvstby_stop_t { kSimUsbvstbyNoRegulator, kSimUsbvstbyWithRegulator } |
| SIM USB voltage regulator in standby mode setting during VLPR and VLPW modes. | |
| enum | sim_cmtuartpad_strengh_t { kSimCmtuartSinglePad, kSimCmtuartDualPad } |
| SIM CMT/UART pad drive strength. | |
| enum | sim_ptd7pad_strengh_t { kSimPtd7padSinglePad, kSimPtd7padDualPad } |
| SIM PTD7 pad drive strength. | |
| enum | sim_flexbus_security_level_t { kSimFbslLevel0, kSimFbslLevel1, kSimFbslLevel2, kSimFbslLevel3 } |
| SIM FlexBus security level. | |
| enum | sim_pretrgsel_t { kSimAdcPretrgselA, kSimAdcPretrgselB } |
| SIM ADCx pre-trigger select. | |
| enum | sim_trgsel_t { kSimAdcTrgselExt, kSimAdcTrgSelHighSpeedComp0, kSimAdcTrgSelHighSpeedComp1, kSimAdcTrgSelHighSpeedComp2, kSimAdcTrgSelPit0, kSimAdcTrgSelPit1, kSimAdcTrgSelPit2, kSimAdcTrgSelPit3, kSimAdcTrgSelFtm0, kSimAdcTrgSelFtm1, kSimAdcTrgSelFtm2, kSimAdcTrgSelFtm3, kSimAdcTrgSelRtcAlarm, kSimAdcTrgSelRtcSec, kSimAdcTrgSelLptimer, kSimAdcTrgSelHigSpeedComp3 } |
| SIM ADCx trigger select. | |
| enum | sim_uart_rxsrc_t { kSimUartRxsrcPin, kSimUartRxsrcCmp0, kSimUartRxsrcCmp1, kSimUartRxsrcReserved } |
| SIM receive data source select. | |
| enum | sim_uart_txsrc_t { kSimUartTxsrcPin, kSimUartTxsrcCmp0, kSimUartTxsrcCmp1, kSimUartTxsrcReserved } |
| SIM transmit data source select. | |
| enum | sim_ftm_trg_src_t { kSimFtmTrgSrc0, kSimFtmTrgSrc1 } |
| SIM FlexTimer x trigger y select. | |
| enum | sim_ftm_clk_sel_t { kSimFtmClkSel0, kSimFtmClkSel1 } |
| SIM FlexTimer external clock select. | |
| enum | sim_ftm_ch_src_t { kSimFtmChSrc0, kSimFtmChSrc1, kSimFtmChSrc2, kSimFtmChSrc3 } |
| SIM FlexTimer x channel y input capture source select. | |
| enum | sim_ftm_flt_sel_t { kSimFtmFltSel0, kSimFtmFltSel1 } |
| SIM FlexTimer x Fault y select. | |
| enum | sim_tpm_clk_sel_t { kSimTpmClkSel0, kSimTpmClkSel1 } |
| SIM Timer/PWM external clock select. | |
| enum | sim_tpm_ch_src_t { kSimTpmChSrc0, kSimTpmChSrc1 } |
| SIM Timer/PWM x channel y input capture source select. | |
| enum | sim_hal_status_t { kSimHalSuccess, kSimHalFail, kSimHalNoSuchModule, kSimHalNoSuchClockSrc, kSimHalNoSuchDivider } |
| SIM HAL API return status. | |
Variables | |
| const sim_clock_name_config_t | kSimClockNameConfigTable [] |
| clock name configuration table for specified CPU defined in fsl_clock_module_names_Kxxx.h | |
|
const sim_clock_gate_module_config_t | kSimClockGateModuleConfigTable [] |
| SIM configuration table for clock module names. | |
| const sim_clock_source_value_t * | kClockSourceValueTable [] |
| clock source value table for specified CPU | |
clock related feature APIs | |
| sim_hal_status_t | clock_hal_set_gate (sim_clock_gate_module_names_t clockModule, uint8_t instance, bool enable) |
| Enables or disables the clock for a specified clock module. More... | |
| sim_hal_status_t | clock_hal_get_gate (sim_clock_gate_module_names_t clockModule, uint8_t instance, bool *isEnabled) |
| Gets the clock enabled or disabled state. More... | |
| sim_hal_status_t | clock_hal_set_clock_source (sim_clock_source_names_t clockSource, uint8_t setting) |
| Sets the clock source setting. More... | |
| sim_hal_status_t | clock_hal_get_clock_source (sim_clock_source_names_t clockSource, uint8_t *setting) |
| Gets the clock source setting. More... | |
| sim_hal_status_t | clock_hal_set_clock_divider (sim_clock_divider_names_t clockDivider, uint32_t setting) |
| Sets the clock divider setting. More... | |
| void | clock_hal_set_clock_out_dividers (uint32_t outdiv1, uint32_t outdiv2, uint32_t outdiv3, uint32_t outdiv4) |
| Sets the clock out dividers setting. More... | |
| sim_hal_status_t | clock_hal_get_clock_divider (sim_clock_divider_names_t clockDivider, uint32_t *setting) |
| Gets the clock divider setting. More... | |
individual field access APIs | |
| static void | sim_set_usbregen (bool enable) |
| Sets the USB voltage regulator enabled setting. More... | |
| static bool | sim_get_usbregen (void) |
| Gets the USB voltage regulator enabled setting. More... | |
| static void | sim_set_usbsstby (sim_usbsstby_stop_t setting) |
| Sets the USB voltage regulator in a standby mode setting during Stop, VLPS, LLS, and VLLS. More... | |
| static sim_usbsstby_stop_t | sim_get_usbsstby (void) |
| Gets the USB voltage regulator in a standby mode setting. More... | |
| static void | sim_set_usbvstby (sim_usbvstby_stop_t setting) |
| Sets the USB voltage regulator in a standby mode during the VLPR or the VLPW. More... | |
| static sim_usbvstby_stop_t | sim_get_usbvstby (void) |
| Gets the USB voltage regulator in a standby mode during the VLPR or the VLPW. More... | |
| static void | sim_set_usswe (bool enable) |
| Sets the USB voltage regulator stop standby write enable setting. More... | |
| static bool | sim_get_usswe (void) |
| Gets the USB voltage regulator stop standby write enable setting. More... | |
| static void | sim_set_uvswe (bool enable) |
| Sets the USB voltage regulator VLP standby write enable setting. More... | |
| static bool | sim_get_uvswe (void) |
| Gets the USB voltage regulator VLP standby write enable setting. More... | |
| static void | sim_set_urwe (bool enable) |
| Sets the USB voltage regulator enable write enable setting. More... | |
| static bool | sim_get_urwe (void) |
| Gets the USB voltage regulator enable write enable setting. More... | |
| void | sim_set_alttrgen (uint8_t instance, bool enable) |
| Sets the ADCx alternate trigger enable setting. More... | |
| bool | sim_get_alttrgen (uint8_t instance) |
| Gets the ADCx alternate trigger enable setting. More... | |
| void | sim_set_pretrgsel (uint8_t instance, sim_pretrgsel_t select) |
| Sets the ADCx pre-trigger select setting. More... | |
| sim_pretrgsel_t | sim_get_pretrgsel (uint8_t instance) |
| Gets the ADCx pre-trigger select setting. More... | |
| void | sim_set_trgsel (uint8_t instance, sim_trgsel_t select) |
| Sets the ADCx trigger select setting. More... | |
| sim_pretrgsel_t | sims_get_trgsel (uint8_t instance) |
| Gets the ADCx trigger select setting. More... | |
| void | sim_set_uart_rxsrc (uint8_t instance, sim_uart_rxsrc_t select) |
| Sets the UARTx receive data source select setting. More... | |
| sim_uart_rxsrc_t | sim_get_uart_rxsrc (uint8_t instance) |
| Gets the UARTx receive data source select setting. More... | |
| void | sim_set_uart_txsrc (uint8_t instance, sim_uart_txsrc_t select) |
| Sets the UARTx transmit data source select setting. More... | |
| sim_uart_txsrc_t | sim_get_uart_txsrc (uint8_t instance) |
| Gets the UARTx transmit data source select setting. More... | |
| static uint32_t | sim_get_fam_id (void) |
| Gets the Kinetis Fam ID in System Device ID register (SIM_SDID). More... | |
| static uint32_t | sim_get_pin_id (void) |
| Gets the Kinetis Pincount ID in System Device ID register (SIM_SDID). More... | |
| static uint32_t | sim_get_rev_id (void) |
| Gets the Kinetis Revision ID in the System Device ID register (SIM_SDID). More... | |
| static uint32_t | sim_get_pf_size (void) |
| Gets the program flash size in the Flash Configuration Register 1 (SIM_FCFG). More... | |
| struct sim_clock_gate_module_config_t |
Data Fields | |
| sim_clock_gate_module_names_t | clockGateModuleName |
| clock module name | |
| uint8_t | deviceInstance |
| device instance | |
| uint32_t | scgcRegAddress |
| clock gate control register address | |
| uint32_t | deviceMask |
| device mask in control register | |
| struct sim_clock_source_value_t |
Data Fields | |
| union { | |
| uint8_t name | |
| sim_clock_names_t clockName | |
| clock name | |
| sim_clock_source_names_t clockSelName | |
| }; | |
| bool | isSel |
| clock sel flag | |
| bool | hasDivider |
| has divider | |
| sim_clock_divider_names_t | dividerName |
| divider name | |
| struct sim_clock_name_config_t |
Data Fields | |
| sim_clock_names_t | clockName |
| clock name | |
| bool | useOtherRefClock |
| if it uses the other ref clock | |
| sim_clock_names_t | otherRefClockName |
| other ref clock name | |
| sim_clock_divider_names_t | dividerName |
| clock divider name | |
| sim_hal_status_t clock_hal_set_gate | ( | sim_clock_gate_module_names_t | clockModule, |
| uint8_t | instance, | ||
| bool | enable | ||
| ) |
This function enables/disables the clock for a specified clock module and instance.
| clockModule | Clock module name defined in the sim_clock_gate_module_names_t |
| instance | Module instance |
| enable | Enable or disable the clock
|
| sim_hal_status_t clock_hal_get_gate | ( | sim_clock_gate_module_names_t | clockModule, |
| uint8_t | instance, | ||
| bool * | isEnabled | ||
| ) |
This function gets the current clock gate status of the specified clock module and instance.
| clockModule | Clock module name defined in sim_clock_gate_module_names_t |
| instance | Module instance |
| isEnabled | returned status, clock is enabled or disabled for the module.
|
| sim_hal_status_t clock_hal_set_clock_source | ( | sim_clock_source_names_t | clockSource, |
| uint8_t | setting | ||
| ) |
This function sets the settings for a specified clock source. Each clock source has its own clock selection settings. See the chip reference manual for clock source detailed settings and the sim_clock_source_names_t for clock sources.
| clockSource | Clock source name defined in sim_clock_source_names_t |
| setting | Setting value |
| sim_hal_status_t clock_hal_get_clock_source | ( | sim_clock_source_names_t | clockSource, |
| uint8_t * | setting | ||
| ) |
This function gets the settings for a specified clock source. Each clock source has its own clock selection settings. See the reference manual for clock source detailed settings and the sim_clock_source_names_t for clock sources.
| clockSource | Clock source name |
| setting | Current setting for the clock source |
| sim_hal_status_t clock_hal_set_clock_divider | ( | sim_clock_divider_names_t | clockDivider, |
| uint32_t | setting | ||
| ) |
This function sets the setting for a specified clock divider. See the reference manual for a supported clock divider and value range and the sim_clock_divider_names_t for dividers.
| clockDivider | Clock divider name |
| divider | Divider setting |
| void clock_hal_set_clock_out_dividers | ( | uint32_t | outdiv1, |
| uint32_t | outdiv2, | ||
| uint32_t | outdiv3, | ||
| uint32_t | outdiv4 | ||
| ) |
This function sets the setting for all clock out dividers at the same time. See the reference manual for a supported clock divider and value range and the sim_clock_divider_names_t for clock out dividers.
| outdiv1 | Outdivider1 setting |
| outdiv2 | Outdivider2 setting |
| outdiv3 | Outdivider3 setting |
| outdiv4 | Outdivider4 setting |
| sim_hal_status_t clock_hal_get_clock_divider | ( | sim_clock_divider_names_t | clockDivider, |
| uint32_t * | setting | ||
| ) |
This function gets the setting for a specified clock divider. See the reference manual for a supported clock divider and value range and the sim_clock_divider_names_t for dividers.
| clockDivider | Clock divider name |
| divider | Divider value pointer |
|
inlinestatic |
This function controls whether the USB voltage regulator is enabled. This bit can only be written when the SOPT1CFG[URWE] bit is set.
| enable | USB voltage regulator enable setting
|
|
inlinestatic |
This function gets the USB voltage regulator enabled setting.
|
inlinestatic |
This function controls whether the USB voltage regulator is placed in a standby mode during Stop, VLPS, LLS, and VLLS modes. This bit can only be written when the SOPT1CFG[USSWE] bit is set.
| setting | USB voltage regulator in standby mode setting
|
|
inlinestatic |
This function gets the USB voltage regulator in a standby mode setting.
|
inlinestatic |
This function controls whether the USB voltage regulator is placed in a standby mode during the VLPR and the VLPW modes. This bit can only be written when the SOPT1CFG[UVSWE] bit is set.
| setting | USB voltage regulator in standby mode setting
|
|
inlinestatic |
This function gets the USB voltage regulator in a standby mode during the VLPR or the VLPW.
|
inlinestatic |
This function controls whether the USB voltage regulator stop standby write feature is enabled. Writing one to this bit allows the SOPT1[USBSSTBY] bit to be written. This register bit clears after a write to SOPT1[USBSSTBY].
| enable | USB voltage regulator stop standby write enable setting
|
|
inlinestatic |
This function gets the USB voltage regulator stop standby write enable setting.
|
inlinestatic |
This function controls whether USB voltage regulator VLP standby write feature is enabled. Writing one to this bit allows the SOPT1[USBVSTBY] bit to be written. This register bit clears after a write to SOPT1[USBVSTBY].
| enable | USB voltage regulator VLP standby write enable setting
|
|
inlinestatic |
This function gets the USB voltage regulator VLP standby write enable setting.
|
inlinestatic |
This function controls whether the USB voltage regulator write enable feature is enabled. Writing one to this bit allows the SOPT1[USBREGEN] bit to be written. This register bit clears after a write to SOPT1[USBREGEN].
| enable | USB voltage regulator enable write enable setting
|
|
inlinestatic |
This function gets the USB voltage regulator enable write enable setting.
| void sim_set_alttrgen | ( | uint8_t | instance, |
| bool | enable | ||
| ) |
This function enables/disables the alternative conversion triggers for ADCx.
| enable | Enable alternative conversion triggers for ADCx
|
| bool sim_get_alttrgen | ( | uint8_t | instance | ) |
This function gets the ADCx alternate trigger enable setting.
| void sim_set_pretrgsel | ( | uint8_t | instance, |
| sim_pretrgsel_t | select | ||
| ) |
This function selects the ADCx pre-trigger source when the alternative triggers are enabled through ADCxALTTRGEN.
| select | pre-trigger select setting for ADCx
|
| sim_pretrgsel_t sim_get_pretrgsel | ( | uint8_t | instance | ) |
This function gets the ADCx pre-trigger select setting.
| void sim_set_trgsel | ( | uint8_t | instance, |
| sim_trgsel_t | select | ||
| ) |
This function selects the ADCx trigger source when alternative triggers are enabled through ADCxALTTRGEN.
| select | trigger select setting for ADCx
|
| sim_pretrgsel_t sims_get_trgsel | ( | uint8_t | instance | ) |
This function gets the ADCx trigger select setting.
| void sim_set_uart_rxsrc | ( | uint8_t | instance, |
| sim_uart_rxsrc_t | select | ||
| ) |
This function selects the source for the UARTx receive data.
| select | the source for the UARTx receive data
|
| sim_uart_rxsrc_t sim_get_uart_rxsrc | ( | uint8_t | instance | ) |
This function gets the UARTx receive data source select setting.
| void sim_set_uart_txsrc | ( | uint8_t | instance, |
| sim_uart_txsrc_t | select | ||
| ) |
This function selects the source for the UARTx transmit data.
| select | the source for the UARTx transmit data
|
| sim_uart_txsrc_t sim_get_uart_txsrc | ( | uint8_t | instance | ) |
This function gets the UARTx transmit data source select setting.
|
inlinestatic |
This function gets the Kinetis Fam ID in System Device ID register.
|
inlinestatic |
This function gets the Kinetis Pincount ID in System Device ID register.
|
inlinestatic |
This function gets the Kinetis Revision ID in System Device ID register.
|
inlinestatic |
This function gets the program flash size in the Flash Configuration Register 1.